<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>首页 - 驴妈妈流立方</title>
<meta name="description" content="overview &amp; stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/bootstrap.min.css" />
<link rel="stylesheet"  href="${request.contextPath}/assets/font-awesome/4.2.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet"  href="${request.contextPath}/assets/css/jquery.gritter.min.css" />
<link rel="stylesheet"href="${request.contextPath}/assets/fonts/fonts.googleapis.com.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/bootstrapValidator.min.css" />
<link rel="stylesheet" href="${request.contextPath}/assets/css/ace.min.css"class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet"  href="${request.contextPath}/assets/css/bsie-paginator.css" />
<link rel="stylesheet"  href="${request.contextPath}/stylesheets/daterangepicker.css">
<link rel="stylesheet" href="${request.contextPath}/assets/css/jquery.gritter.min.css" />
<link rel="stylesheet" href="${request.contextPath}/stylesheets/loading.css" />
<link rel="stylesheet" href="${request.contextPath}/stylesheets/tips.css"/>
</head>
<body class="no-skin" style="background-color: #FFF;">
	<div class="page-content">
		<div class="tabbable">
			<div class="tab-content">
				<div id="manage" class="tab-pane active in">
					<div class="row">
						<div class="col-sm-12">
						<!-- 筛选条件开始 -->
							<div class="row">
								<div class="col-sm-12">
									<div class="widget-box">
										<div class="widget-header">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa"></i>搜索流量统计 
											</h4>
										</div>
										<div class="widget-body" style="background-color: #EFF3F8;">
											<div class="widget-main">
											<form class="form-inline" id="searchForm" method="post" action="#">
												<div class="form-group">
													<label for="exampleInputName2">选择时段
														<input type="text" id="config-demo" name="chooseTime" class="form-control time">
														<button id="app_search" type="button"  onclick="replaceDate(this,'1');" class="btn btn-white btn-sm">
															<span class="ace-icon icon-on-right bigger-110"></span>
															昨日
														</button>
														<button id="app_search" type="button"  onclick="replaceDate(this,'7');" class="btn btn-white btn-sm">
															<span class="ace-icon icon-on-right bigger-110"></span>
															过去7天
														</button>
														<button id="app_search" type="button"  onclick="replaceDate(this,'31');" class="btn btn-white btn-sm">
															<span class="ace-icon icon-on-right bigger-110"></span>
															过去31天
														</button>
													</label>
													
													<label for="exampleInputName" style="margin-left: 30px;">平台：
														<select class="chosen-select" tabindex="2" name="platform_code" id="platform_code" style="width:80px;">
																<option value="">全部</option>
															<!-- <option value="pc">PC</option> -->
																<option value="app">APP</option>
																<option value="wap">WAP</option>
														</select>
													</label>
													
													<button id="search" type="button" class="btn btn-pink btn-sm"  style="margin-left: 50px;">
														<span class="ace-icon fa fa-search icon-on-right bigger-110"></span> Search
													</button>
												</div>
												</form>
											</div>
										</div>
									</div>
								</div>
							</div>
							<!-- 筛选条件结束 -->
					   
						 <!-- 图标开始 -->
						<div class="row">
								 <div class="col-sm-6">
									<div class=" widget-box">
										<div class="widget-header widget-header-flat">
											<h4 class="widget-title lighter">
												<i class="ace-icon fa fa-signal blue"></i>流量趋势分析
											</h4>
											<label class="help_img">
												<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
												<span class='tips'>一段时间内进入综合搜索前置页各渠道逐日的PV量，进一次算一次<s></s></span>
											</label>
										</div>
										<div class="widget-header widget-header-small">
											<div id="sales-charts" style="height: 450px;"></div>
										</div>
									 </div>
									</div>
									<div class="col-sm-6" style="padding-left: 0px!important;">
										 <div class="widget-box">
											<div class="widget-header widget-header-flat">
												<h4 class="widget-title lighter">
													<i class="ace-icon fa fa-star orange"></i>流量总量统计
												</h4>
												<label class="help_img">
													<i class="blue ace-icon fa fa-question-circle bigger-120" style="color:#999999!important;"></i>
													<span class='tips'>进入综合搜索前置页各渠道的PV总量<s></s></span>
												</label>
											</div>
											<div class="widget-header widget-header-small">
												<div id="statistic-charts" style="height: 450px;"></div>
											</div>
										</div>
								 </div>
							</div>
								<form action="${request.contextPath}/searchStatistic/export" id="exportForm" method="post" hidden="true">
												<input id="choose_date_Export" name="choose_date" type="text" hidden="true">
												<input id="platform_code_Export" name="platform_code" type="text" hidden="true">
												<input id="type" name="type" type="text" hidden="true">
												<button type="submit" hidden="true" id="exportExcel" class="btn btn-primary" ></button>
											</form>						
						 <!-- 图标结束-->
				 </div>
				</div>
			</div>
		</div>
		 </div>
	</div>
	<script src="${request.contextPath}/assets/js/jquery.2.1.1.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery-ui.custom.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery.ui.touch-punch.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootbox.min.js"></script>
	<script src="${request.contextPath}/assets/js/jquery.gritter.min.js"></script>
	<script src="${request.contextPath}/assets/js/spin.min.js"></script>
	<script src="${request.contextPath}/assets/js/ace-elements.min.js"></script>
	<script src="${request.contextPath}/assets/js/ace.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootstrapValidator.min.js"></script>
	<script src="${request.contextPath}/assets/js/user/base.js"></script>
	<script src="${request.contextPath}/assets/js/ace-extra.min.js"></script>
	<script src="${request.contextPath}/assets/js/moment.min.js"></script>
	<script src="${request.contextPath}/assets/js/bootstrap-datetimepicker.min.js"></script>
	<script type="text/javascript"  src="${request.contextPath}/javascripts/bootstrap.min.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/moment.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/daterangepicker.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/dateRange.js"></script>
	<script src="${request.contextPath}/assets/js/d3.v3.min.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/loading.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/g2.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/g2-modal.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/slider.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/FileSaver.js"></script>
	<script type="text/javascript" src="${request.contextPath}/javascripts/export-csv.js"></script>
		
	<script type="text/javascript">
	d3.select(self.frameElement).style("height", "800px");
	$(document).ready(function(){
	 	getSearchDate();
	});
	
	$("#search").on("click",function(){
		getSearchDate();
	});
	function getSearchDate(){
		var choose_date = $("#config-demo").val();
		var platform_code = $("#platform_code").val();
		$.ajax({
			url : '${request.contextPath}/searchStatistic/searchAjaxData',
			type : "POST",
			data : {
				// choose_date:choose_date,
				beginDate:choose_date.split("-")[0]+" 00:00:00",
				endDate:choose_date.split("-")[1]+" 23:59:59",
				platformCode:platform_code
			},
			beforeSend: function(){
 			   $("#search").attr("disabled",true);
 			    openPartialLayer($("#statistic-charts"));
 			    openPartialLayer($("#sales-charts"));
	    	 },
		    complete: function(){
		    	$("#search").attr("disabled",false);
		    	removeLoading($("#statistic-charts"));
		    	removeLoading($("#sales-charts"));
		    },
			success:function(data) {
			    if(data.code != 0){
			        return;
				}
			    var data =data.data
				var defs = {
						'category': {
							alias : '渠道'
						},
						'amount': {
							alias :'流量（PV）'
						},
						'time':{
							type: 'time',
							tickCount: 8
						}
					};
                	histogramModal(data.barData,'statistic-charts','category','amount','渠道','流量（PV）','450',defs);
                	lineChartModal(data.lineData,'sales-charts','time','amount','category','','流量（PV）','450',defs);
			},
			error:function(data) {
				showMsg("查询数据有误");
			}
		});
	}
	
/*	function exportData(type){
		var choose_date = $("#config-demo").val();
		var platform_code = $("#platform_code").val();
			$("#choose_date_Export").val(choose_date);
			$("#platform_code_Export").val(platform_code);
			$("#type").val(type);
			$("#exportExcel").click();
	}*/
</script>
</body>
</html>